
//2559.统计范围内的元音字符串数
class Solution {
public:
    vector<int> vowelStrings(vector<string>& words, vector<vector<int>>& queries) {
        //此题不再是统计子数组的和了,而是统计一定范围内字符串以元音开始和结束的个数
        int n = words.size(),m = queries.size();
        unordered_set<char> s({'a','e','i','o','u'});
        vector<int> lsum(n+1);
        for(int i = 0; i < n;i++)
            lsum[i+1] = lsum[i] + (s.count(words[i][0])&&s.count(words[i].back()));

        vector<int> ret(m);
        for(int i = 0 ;i < m;i++)
            ret[i] = lsum[queries[i][1]+1] - lsum[queries[i][0]];

        return ret;
    }
};